package org.homly.admin.tag.product;

import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.homly.sql.SQLTool;

@SuppressWarnings("serial")
public class ProductExtPicListTag extends TagSupport {

	private String name = "rows";
	private String productId = null;

	@Override
	public int doStartTag() throws JspException {

		String sql = "select * from product_append_pic where product_append_pic_status=1 and"
				+ " product_id=" + productId;
		@SuppressWarnings("rawtypes")
		List list;
		try {
			list = SQLTool.query(sql);
			pageContext.setAttribute(name, list);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return super.doStartTag();
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

}
